<template>
  <div>
    <van-cell-group>
      <van-field v-model="user.phone" label="手机号" placeholder="请输入手机号" />
    </van-cell-group>
     <van-cell-group>
      <van-field v-model="user.password" label="密码" placeholder="请输入密码" />
    </van-cell-group>
    <div style="margin: 16px;">
    <van-button round block type="info" native-type="submit" color="#4400CC" @click="login">登录</van-button>
  </div>

    
  </div>
</template>

<script>
import { Toast } from 'vant';
import { reqLogin } from '../../http/api';
export default {
  data() {
    return {
      user: {
        phone: "",
        password: "",
      },
    };
  },
  methods: {
    login() {
      reqLogin(this.user).then(res=>{
        if(res.data.code===200){
          Toast.success(res.data.msg)
          localStorage.setItem("isLogin",JSON.stringify(res.data.list))
          this.$router.push("/index/home")
        }
      })


    },
  },
};
</script>

<style>
</style>